<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script src="../public.js"></script>
<script>
    //三个接口：

    //http://api.k780.com/?app=weather.realtime&weaId=1&ag=today,futureDay,lifeIndex,futureHour&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json

    //http://api.k780.com/?app=idcard.get&idcard=110101199001011114&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json

    //http://api.k780.com/?app=phone.get&phone=13800138000&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json

    //第一个数据请求成功，再请求下一个数据接口。必须采用嵌套。
    //回调函数嵌套的时候，代码的可读性很差。
    //回调地狱
    $ajax({
        url: 'http://api.k780.com/?app=weather.realtime&weaId=1&ag=today,futureDay,lifeIndex,futureHour&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json',
        success: function(data) {
            console.log(data);
            console.log('------------------------------------------------');
            $ajax({
                url: 'http://api.k780.com/?app=idcard.get&idcard=110101199001011114&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json',
                success: function(data) {
                    console.log(data);
                    console.log('------------------------------------------------');
                    $ajax({
                        url: 'http://api.k780.com/?app=phone.get&phone=13800138000&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json',
                        success: function(data) {
                            console.log(data);
                        },
                        error: function(err) {
                            throw new Error(err);
                        }
                    });
                },
                error: function(err) {
                    throw new Error(err);
                }
            });
        },
        error: function(err) {
            throw new Error(err);
        }
    });
</script>